﻿// Parts Copyright 2008 Newgrove Consultants Limited
// Modified By John Diss 
// From original work:
//
// Copyright 2006 - Ricardo Stuven (rstuven@gmail.com)
//
// This file is part of MsSqlSpatial.
// MsSqlSpatial is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// MsSqlSpatial is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.

// You should have received a copy of the GNU Lesser General Public License
// along with MsSqlSpatial; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 

#if PENDING_FEATURE

using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;

/// <summary>
/// PostGIS docs:
/// Aggregate. Creates a GeometryCollection containing possible polygons formed from the costituent linework of a set of geometries.
/// </summary>
[Serializable]
[SqlUserDefinedAggregate(Format.Native)]
public struct Polygonize
{
	public void Init()
	{
		// Put your code here
	}

	public void Accumulate(SqlBytes Value)
	{
		// Put your code here
	}

	public void Merge(Polygonize Group)
	{
		// Put your code here
	}

	public SqlBytes Terminate()
	{
		// Put your code here

		/*
		 * From PolygonizeExample.cs:
		 * 
		
		WKTReader rdr = new WKTReader();
		IList lines = new ArrayList();
		
		lines.Add(rdr.Read("LINESTRING (0 0 , 10 10)"));            // isolated edge
        lines.Add(rdr.Read("LINESTRING (185 221, 100 100)"));       //dangling edge
        lines.Add(rdr.Read("LINESTRING (185 221, 88 275, 180 316)"));
        lines.Add(rdr.Read("LINESTRING (185 221, 292 281, 180 316)"));
        lines.Add(rdr.Read("LINESTRING (189 98, 83 187, 185 221)"));
        lines.Add(rdr.Read("LINESTRING (189 98, 325 168, 185 221)"));
		
		Polygonizer polygonizer = new Polygonizer();
		polygonizer.Add(lines);
		
		ICollection polys = polygonizer.Polygons;
		
		Console.WriteLine("Polygons formed (" + polys.Count + "):");
        foreach(object obj in polys)
		    Console.WriteLine(obj);
		
		 */

		return SqlBytes.Null;
	}

	// This is a place-holder member field
	private int var1;

}
#endif